<template>
	<div class="wrapper">

		<!-- header部分 -->
		<header>
			<p>会员中心</p>
			<!-- 返回键 -->
			<GoBackButton></GoBackButton>
		</header>

		<UpperBox></UpperBox>

		<!--svip部分-->
		<div class="title-box">
			<div class="title-box-div">
				<ul>
					<li>
						<span>精选</span>
					</li>
					<li>
						<span>优惠</span>
					</li>
					<li>
						<span>会员卡</span>
					</li>
				</ul>
			</div>
			<div class="title-box-under">
				<div class="title-box-svip">
					<div class="svip">
						<span class="svip-s">S</span>
						<span class="svip-v">V</span>
						<span class="svip-i">I</span>
						<span class="svip-p">P</span>
						<span class="svip-unuse">未开通</span>
					</div>
					<div>
						<span class="svip-save">预计每年可省500元</span>
					</div>
				</div>
			</div>
		</div>


		<div class="mid-box">
			<div class="mid-upper-box">
				<ul>
					<li>超级会员</li>
					<li>普通会员</li>
				</ul>
			</div>
			<div class="mid-mid-box">
				<ul>
					<li>
						<div class="time-length">
							<span>连续包月</span>
						</div>
						<div class="price">
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>20</span>
						</div>
						<div class="origin-price">
							<span>原价</span>
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>25</span>
						</div>
					</li>
					<li>
						<div class="time-length">
							<span>1个月</span>
						</div>
						<div class="price">
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>25</span>
						</div>
						<div class="origin-price">
							<span>原价</span>
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>30</span>
						</div>
					</li>
					<li>
						<div class="time-length">
							<span>3个月</span>
						</div>
						<div class="price">
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>70</span>
						</div>
						<div class="origin-price">
							<span>原价</span>
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>90</span>
						</div>
					</li>
					<li>
						<div class="time-length">
							<span>6个月</span>
						</div>
						<div class="price">
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>120</span>
						</div>
						<div class="origin-price">
							<span>原价</span>
							<i class="fa fa-jpy" aria-hidden="true"></i>
							<span>180</span>
						</div>
					</li>
				</ul>
			</div>
			<div class="mid-under-box">
			</div>
		</div>

		<div class="under-box">
			<div class="vip-button" @click="ApplyForMembership">
				<span>开通会员</span>
			</div>
		</div>

		<!-- 底部菜单部分 -->
		<Footer></Footer>
	</div>
</template>
<script>
	import Footer from '@/components/Footer.vue';
	import GoBackButton from '@/components/GoBackButton.vue';
	import UpperBox from '@/components/UpperBox.vue';

	export default {
		name: 'SuperVIP',
		data() {
			return {
				user: {}
			}
		},
		created() {
			this.user = this.$getSessionStorage('user');
		},
		methods: {
			ApplyForMembership() {
				this.$axios.patch('users',
					JSON.stringify({
						userId: this.user.userId
					}), {
						headers: {
							'Content-Type': "application/json"
						}
					}
				).then(response => {
					if(response.data > 0) {
						alert('您已成为VIP');
						this.user.isVIP=1;
						this.$setSessionStorage('user',this.user);
					} else {
						alert('成为VIP失败');
					}
				}).catch(error => {
					console.error(error);
				});
			}
		},
		components: {
			Footer,
			GoBackButton,
			UpperBox
		}
	}
</script>
<style scoped>
	/****************** 总容器 ******************/
	.wrapper {
		width: 100%;
		height: 100%;
	}

	/****************** header部分 ******************/
	.wrapper header {
		width: 100%;
		height: 12vw;
		background-color: #0097FF;
		color: #fff;
		font-size: 4.8vw;

		position: fixed;
		left: 0px;
		top: 0;
		z-index: 1000;

		display: flex;
		justify-content: center;
		align-items: center;
	}

	/****************** 上部部分 ******************/
	.wrapper .title-box {
		background-color: #8b80bc;
	}

	.wrapper .title-box .title-box-div {
		width: 100%;
		height: 15vw;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .title-box .title-box-div ul {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .title-box .title-box-div ul li {
		font-size: 6vw;
		font-family: "微软雅黑";
		color: #ffffff;
		margin-left: 5vw;
		margin-right: 5vw;
	}

	.wrapper .title-box .title-box-under {
		padding-top: 5vw;
		display: flex;
		justify-content: center;
		align-items: center;

	}

	.wrapper .title-box .title-box-under .title-box-svip {
		width: 80%;
		height: 24vw;
		background-color: #f2d284;
		border-radius: 2.5vw 2.5vw 0 0;
	}

	.wrapper .title-box .title-box-under .title-box-svip .svip {
		margin-top: 3vw;
		margin-left: 3vw;
	}

	.wrapper .title-box .title-box-under .title-box-svip .svip .svip-s {
		font-family: 'Arial', sans-serif;
		font-size: 10vw;
		margin-right: 1.5vw;
		font-weight: bold;
		font-style: italic;
		color: #d7a15b;
	}

	.wrapper .title-box .title-box-under .title-box-svip .svip .svip-v {
		font-family: 'Arial', sans-serif;
		font-size: 10vw;
		margin-right: 1.5vw;
		font-weight: bold;
		font-style: italic;
		color: #bd8647;
	}

	.wrapper .title-box .title-box-under .title-box-svip .svip .svip-i {
		font-family: 'Arial', sans-serif;
		font-size: 10vw;
		margin-right: 1.5vw;
		font-weight: bold;
		font-style: italic;
		color: #af7f4e;
	}

	.wrapper .title-box .title-box-under .title-box-svip .svip .svip-p {
		font-family: 'Arial', sans-serif;
		font-size: 10vw;
		font-weight: bold;
		font-style: italic;
		color: #966a45;
	}

	.wrapper .title-box .title-box-under .title-box-svip .svip .svip-unuse {
		font-family: 'Arial', sans-serif;
		color: #d3884a;
		font-size: 4vw;
		font-weight: 600;
	}

	.wrapper .title-box .title-box-under .title-box-svip .svip-save {
		margin-left: 3vw;
		margin-top: 3.5vw;
		font-family: 'Arial', sans-serif;
		color: #d3884a;
		font-size: 4vw;
		font-weight: 500;
	}

	/****************** 中部部分 ******************/
	.wrapper .mid-box {
		display: flex;
		flex-direction: column;
	}

	.wrapper .mid-box .mid-upper-box {
		display: flex;
		justify-content: center;
		align-items: center;
		border-bottom-style: solid;
		border-bottom-width: 0.5vw;
		border-bottom-color: #8b80bc;
	}

	.wrapper .mid-box .mid-upper-box ul {
		height: 14vw;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .mid-box .mid-upper-box ul li {
		margin-left: 12vw;
		margin-right: 12vw;
		font-size: 5.5vw;
		color: #8b80bc;
		font-weight: 500;
		font-family: "微软雅黑";
	}

	.wrapper .mid-box .mid-mid-box {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .mid-box .mid-mid-box ul {
		margin-top: 2vw;
		margin-bottom: 2vw;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .mid-box .mid-mid-box ul li {
		margin-left: 2vw;
		margin-right: 2vw;
		display: flex;
		flex-direction: column;
		border: #feec86 0.5vw solid;

	}

	.wrapper .mid-box .mid-mid-box ul li .time-length {
		border: #feec86 0.5vw solid;
		background-color: #feec86;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .mid-box .mid-mid-box ul li .time-length span {
		font-weight: 550;
		font-family: "微软雅黑";
		color: #000000;
		margin: 1vw;
	}

	.wrapper .mid-box .mid-mid-box ul li .price {
		height: 15vw;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .mid-box .mid-mid-box ul li .price span {
		font-weight: 900;
		font-size: 6vw;
		font-family: "微软雅黑";
		color: #000000;
	}

	.wrapper .mid-box .mid-mid-box ul li .origin-price {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .mid-box .mid-mid-box ul li .origin-price span {
		font-weight: 500;
		font-size: 4vw;
		font-family: "微软雅黑";
		color: #000000;
	}

	.wrapper .mid-box .mid-under-box {
		background-color: #ffffff;
		width: 100%;
		height: 6vw;
		border-bottom: #f6f7f9 4vw solid;
	}

	.wrapper .under-box {
		width: 100%;
		height: 25vw;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.wrapper .under-box .vip-button {
		background-color: #7d73b0;
		width: 90%;
		height: 14vw;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 2vw;
	}

	.wrapper .under-box span {
		color: #ffffff;
		font-size: 5vw;
		font-family: "微软雅黑";
	}
</style>
